package com.inet.consoleservices;

import java.util.HashMap;
import java.util.Map;

import org.json.JSONException;
import org.json.JSONObject;

import android.app.Activity;
import android.content.Context;
import android.content.IntentFilter;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;
import com.inet.receiver.MyBroadcastReceiver;
import com.inet.receiver.MyHandler;
import com.inet.request.ServerRequest;
import com.inet.util.HttpUtil;
import com.inet.util.L;
import com.inet.util.Utils;

public class MainActivity extends Activity {
	
	private ImageView qrCodeIv;
	Bitmap qrCodeBmp = null;
	public static String qrcodeUrl;
	public static long ida2a2;
	private MyBroadcastReceiver QrcodeReceiver;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		setQrcode();
		
	}

	
	@Override
	protected void onDestroy() {
		super.onDestroy();
	}
	
	private void setQrcode() {
		qrCodeIv=(ImageView) findViewById(R.id.qrcode_iv);
		qrCodeIv.setClickable(true);
		qrCodeIv.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				L.i("qrCodeIv  onClick");
				try {
					Bitmap bitmap=Utils.Create2DCode(qrcodeUrl, getApplicationContext());
					qrCodeIv.setImageBitmap(bitmap);
					L.i("qrCodeIv  set success");
				} catch (WriterException e) {
					e.printStackTrace();
				}			
				
				
			}
		});
	}
	
	
}
